//
//  MovieTableViewCell.m
//  PlayerFix
//
//  Created by dllo on 15/11/6.
//  Copyright © 2015年 DAT. All rights reserved.
//

#import "MovieTableViewCell.h"
#import "DataMinModel.h"
@implementation MovieTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
    
}

- (void)createSubViews
{
    }

- (void)setVideoArray:(NSArray *)videoArray
{
    if (_videoArray != videoArray) {
        _videoArray = videoArray;
    }
    for (NSInteger i = 0; i < _videoArray.count; i++) {
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.layer.borderColor = [[UIColor lightGrayColor] CGColor];
        button.layer.borderWidth = 1;
        button.frame = CGRectMake(30, i * 30, 315, 27);
        [self.contentView addSubview:button];
        [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
        button.tag = 1000 + i;
        DataMinModel *dataMinModel = [_videoArray objectAtIndex:i];
        [button setTitle:dataMinModel.title forState:UIControlStateNormal];
        [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    }

}



- (void)buttonAction:(UIButton *)button{
    
    DataMinModel *dataMinModel = [_videoArray objectAtIndex:button.tag - 1000];
    
    [self.Delegate getMessage:dataMinModel.m3u8 :_dataModel.title];
}


@end
